<?PHP
if (!session_start()) { session_start(); };
/*if (!isset($_SESSION['lgnapproved'])) {
	die(header('Location: login.php'));
}*/

include("functions.php");
include("cnnxn.php");
connect();

if (isset($_POST['submit'])) {

$fieldnames="";
$fieldvalues="";
while (list($key,$value) = each($_POST)) {
	$fieldnames=$fieldnames.$key.',';
	if (ctype_digit($value)) {
       $fieldvalues=$fieldvalues.$value.',';
   } else {
       $fieldvalues=$fieldvalues.'"'.addslashes($value).'",';
   }
}
$fieldnames=substr_replace($fieldnames,"",-8);
$fieldvalues=substr_replace($fieldvalues,"",-10);
$SQLadd='INSERT INTO av_organization ('.$fieldnames.') VALUES ('.$fieldvalues.');';
//print $SQLadd;
$sendit_add=mysqli_query($db,$SQLadd) or die(mysqli_error($db));
die(header("Location: av_organization_viewall.php"));
}
?>
